// 动物基类
open class Animal(val name: String) {
    open fun makeSound() {
        println("$name 发出声音")
    }
}

// 狗继承自动物
class Dog(name: String) : Animal(name) {
//    override fun makeSound() {
//        println("$name 汪汪叫")
//    }

    fun wagTail() {
        println("$name 摇尾巴")
    }
}

// 猫继承自动物
class Cat(name: String) : Animal(name) {
    override fun makeSound() {
        println("$name 喵喵叫")
    }

    fun climbTree() {
        println("$name 爬树")
    }
}

fun main() {
    val dog = Dog("旺财")
    dog.makeSound()
    dog.wagTail()
    val cat = Cat("小花")
    cat.makeSound()
    cat.climbTree()
}
